{
  "properties" : { },
  "id" : "1ca7db2e1db34f2e9a43c5659cc45912",
  "script" : null,
  "groupId" : "3c96b136ec424b4ba5425699a669f2e1",
  "name" : "保存工作流-进行中",
  "createTime" : 1731327805995,
  "updateTime" : 1713024595023,
  "lock" : null,
  "createBy" : null,
  "updateBy" : null,
  "path" : "/save",
  "method" : "POST",
  "parameters" : [ ],
  "options" : [ ],
  "requestBody" : "{\n  \"project_id\": 65,\n  \"flows\": [\n    {\n      \"id\": 186,\n      \"project_id\": 65,\n      \"flow_id\": 54,\n      \"name\": \"待处理\",\n      \"status\": \"start\",\n      \"turns\": [\n        186,\n        187,\n        188,\n        189,\n        190,\n        -288709\n      ],\n      \"userids\": \"[]\",\n      \"usertype\": \"add\",\n      \"userlimit\": 0,\n      \"columnid\": 0,\n      \"sort\": 0,\n      \"created_at\": null,\n      \"updated_at\": null\n    },\n    {\n      \"id\": 187,\n      \"project_id\": 65,\n      \"flow_id\": 54,\n      \"name\": \"进行中\",\n      \"status\": \"progress\",\n      \"turns\": [\n        186,\n        187,\n        188,\n        189,\n        190,\n        -288709\n      ],\n      \"userids\": \"[]\",\n      \"usertype\": \"add\",\n      \"userlimit\": 0,\n      \"columnid\": 0,\n      \"sort\": 1,\n      \"created_at\": null,\n      \"updated_at\": null\n    },\n    {\n      \"id\": 188,\n      \"project_id\": 65,\n      \"flow_id\": 54,\n      \"name\": \"待测试\",\n      \"status\": \"test\",\n      \"turns\": [\n        186,\n        187,\n        188,\n        189,\n        190,\n        -288709\n      ],\n      \"userids\": \"[]\",\n      \"usertype\": \"add\",\n      \"userlimit\": 0,\n      \"columnid\": 0,\n      \"sort\": 2,\n      \"created_at\": null,\n      \"updated_at\": null\n    },\n    {\n      \"id\": 189,\n      \"project_id\": 65,\n      \"flow_id\": 54,\n      \"name\": \"已完成\",\n      \"status\": \"end\",\n      \"turns\": [\n        186,\n        187,\n        188,\n        189,\n        190,\n        -288709\n      ],\n      \"userids\": \"[]\",\n      \"usertype\": \"add\",\n      \"userlimit\": 0,\n      \"columnid\": 0,\n      \"sort\": 3,\n      \"created_at\": null,\n      \"updated_at\": null\n    },\n    {\n      \"id\": 190,\n      \"project_id\": 65,\n      \"flow_id\": 54,\n      \"name\": \"已取消\",\n      \"status\": \"end\",\n      \"turns\": [\n        186,\n        187,\n        188,\n        189,\n        190,\n        -288709\n      ],\n      \"userids\": \"[]\",\n      \"usertype\": \"add\",\n      \"userlimit\": 0,\n      \"columnid\": 0,\n      \"sort\": 4,\n      \"created_at\": null,\n      \"updated_at\": null\n    },\n    {\n      \"id\": -288709,\n      \"name\": \"已处理\",\n      \"status\": \"end\",\n      \"turns\": [\n        186,\n        187,\n        188,\n        189,\n        190,\n        -288709\n      ],\n      \"userids\": [],\n      \"usertype\": \"add\",\n      \"userlimit\": 0,\n      \"columnid\": 0,\n      \"sort\": 5\n    }\n  ]\n}",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"code\": 400,\n    \"message\": \"至少需要1个开始状态\",\n    \"data\": null,\n    \"timestamp\": 1711591926381,\n    \"executeTime\": 35\n}",
  "description" : null,
  "requestBodyDefinition" : {
    "name" : "root",
    "value" : "",
    "description" : "",
    "required" : false,
    "dataType" : "Object",
    "type" : null,
    "defaultValue" : null,
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ {
      "name" : "project_id",
      "value" : "64",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "flows",
      "value" : "",
      "description" : "",
      "required" : false,
      "dataType" : "Array",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ {
        "name" : "",
        "value" : "",
        "description" : "",
        "required" : false,
        "dataType" : "Object",
        "type" : null,
        "defaultValue" : null,
        "validateType" : "",
        "error" : "",
        "expression" : "",
        "children" : [ {
          "name" : "id",
          "value" : "176",
          "description" : "",
          "required" : false,
          "dataType" : "Integer",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "project_id",
          "value" : "64",
          "description" : "",
          "required" : false,
          "dataType" : "Integer",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "flow_id",
          "value" : "53",
          "description" : "",
          "required" : false,
          "dataType" : "Integer",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "name",
          "value" : "待处理",
          "description" : "",
          "required" : false,
          "dataType" : "String",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "status",
          "value" : "start",
          "description" : "",
          "required" : false,
          "dataType" : "String",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "turns",
          "value" : "",
          "description" : "",
          "required" : false,
          "dataType" : "Array",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ {
            "name" : "",
            "value" : "176",
            "description" : "",
            "required" : false,
            "dataType" : "Integer",
            "type" : null,
            "defaultValue" : null,
            "validateType" : "",
            "error" : "",
            "expression" : "",
            "children" : [ ]
          } ]
        }, {
          "name" : "userids",
          "value" : "[]",
          "description" : "",
          "required" : false,
          "dataType" : "String",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "usertype",
          "value" : "add",
          "description" : "",
          "required" : false,
          "dataType" : "String",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "userlimit",
          "value" : "0",
          "description" : "",
          "required" : false,
          "dataType" : "Integer",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "columnid",
          "value" : "0",
          "description" : "",
          "required" : false,
          "dataType" : "Integer",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "sort",
          "value" : "0",
          "description" : "",
          "required" : false,
          "dataType" : "Integer",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "created_at",
          "value" : "null",
          "description" : "",
          "required" : false,
          "dataType" : "Object",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "updated_at",
          "value" : "null",
          "description" : "",
          "required" : false,
          "dataType" : "Object",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        } ]
      } ]
    } ]
  },
  "responseBodyDefinition" : {
    "name" : "",
    "value" : "",
    "description" : "",
    "required" : false,
    "dataType" : "Object",
    "type" : null,
    "defaultValue" : null,
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ {
      "name" : "code",
      "value" : "400",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "message",
      "value" : "至少需要1个开始状态",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "data",
      "value" : "null",
      "description" : "",
      "required" : false,
      "dataType" : "Object",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "timestamp",
      "value" : "1711560039607",
      "description" : "",
      "required" : false,
      "dataType" : "Long",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "executeTime",
      "value" : "19",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    } ]
  }
}
================================
import log
import '@/project/addFlow' as addFlow;
flows = body.flows
log.info("flows" + flows)
if (flows.size() < 1) {
    exit 400, "参数异常";
}
var projectFlow = addFlow(flows, body.project_id)
return projectFlow